﻿using BattleNet.Entities.Enums;

namespace BattleNet.Entities
{
    public class Realm
    {
        public string Name { get; set; }
        public RealmStatus Status { get; set; }
        public PopulationStatus Population { get; set; }
        public RealmType Type { get; set; }
        public bool Queue { get; set; }
        public string Locale { get; set; }

        public bool Equals(Realm other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Name, Name) && Equals(other.Status, Status) && Equals(other.Population, Population) && Equals(other.Type, Type) && other.Queue.Equals(Queue) && Equals(other.Locale, Locale);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (Realm)) return false;
            return Equals((Realm) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = (Name != null ? Name.GetHashCode() : 0);
                result = (result*397) ^ Status.GetHashCode();
                result = (result*397) ^ Population.GetHashCode();
                result = (result*397) ^ Type.GetHashCode();
                result = (result*397) ^ Queue.GetHashCode();
                result = (result*397) ^ (Locale != null ? Locale.GetHashCode() : 0);
                return result;
            }
        }
    }
}
